<div class="container">
  <h1>get_max()</h1>
  <p class="signature">public function get_max(?string $target_table = null): ?int</p>
  <h2>Description</h2>
  <div class="description">
    <p>
      Retrieves the maximum 'id' value from the specified database table. This method constructs and executes an SQL query to fetch the maximum 'id' value from the table. It returns the maximum 'id' value as an integer, or 0 if the table is empty, or null if no table is specified.
    </p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
        <th>Default</th>
        <th>Required</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>target_table</td>
        <td>string|null</td>
        <td>(optional) The name of the database table to query. When a table name is not explicitly passed into the method, the table name will be assumed to be the value of the first URL segment.</td>
        <td>'First URL segment'</td>
        <td>No</td>
      </tr>
    </tbody>
  </table>
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>int|null</td>
        <td>Returns the maximum 'id' value from the table. Returns 0 if the table is empty or null if no table is specified.</td>
      </tr>
    </tbody>
  </table>
  <h2>Example Usage #1</h2>
  <p>In the example below, the table name ('products') is being passed into the method as an argument.</p>
  <div class="example">
    <pre>$max_id = $this->model->get_max('products');</pre>
  </div>
  <h2>Example Usage #2</h2>
  <p>In this alternative example, no table name has been passed into the method. This means that the table name will be assumed to be the value of the first URL segment.</p>
  <div class="example">
    <pre>$max_id = $this->model->get_max();</pre>
  </div>
</div>
